// var timeoutId = -1;
// $("#searchCate").bind("mouseover", function(){
// 	clearTimeout(timeoutId);
// 	var offset = $(this).offset();
// 	var h = parseInt($(this).css("height"));
// 	$(".dropdown-menu").offset({
// 		left: offset.left,
// 		top: 46
// 	});
// 	$(".dropdown-menu").show();
// });
// $("#searchCate").bind("mouseout", function(){
// 	// hideDropmenu();
// });

// $(".dropdown-menu").bind("mouseover", function(){
// 	clearTimeout(timeoutId);
// });

// $(".dropdown-menu").bind("mouseout", function(){
// 	// hideDropmenu();
// });

// function hideDropmenu()
// {
// 	timeoutId = setTimeout(function(){
// 		$(".dropdown-menu").hide();
// 		$(".dropdown-menu").css("left", "0px");
// 		$(".dropdown-menu").css("top", "0px");
// 	}, 200);
// }

var jj_profileTimeoutId = -1;
var jj_curFloater;
var jj_trigger;
$(".float_trigger").bind("mouseover", function(event){
	clearTimeout(jj_profileTimeoutId);
	var tempTarget = $(this).attr("trigger-target");
	if(jj_curFloater && jj_curFloater != tempTarget){
		hideFloatPanelImmedia();
	}
	jj_curFloater = tempTarget;
	jj_trigger = $(this);
	if($(this).attr("no-toggle-bg") != "true")
	{
		$(this).find("a").addClass("link_focus");
	}
	var offset = $(this).offset();
	var h = parseInt($(this).css("height"));
	$("." + jj_curFloater).offset({
		left: offset.left,
		top: offset.top + h
	});
	$("." + jj_curFloater).show();

	$("." + jj_curFloater).unbind("mouseover");
	$("." + jj_curFloater).bind("mouseover", function(){
		clearTimeout(jj_profileTimeoutId);
	});

	$("." + jj_curFloater).unbind("mouseout");
	$("." + jj_curFloater).bind("mouseout", function(){
		hideFloatPanel();
	});
});
$(".float_trigger").bind("mouseout", function(){
	hideFloatPanel();
});

function hideFloatPanel()
{
	jj_profileTimeoutId = setTimeout(function(){
		$("." + jj_curFloater).hide();
		$("." + jj_curFloater).css("left", "0px");
		$("." + jj_curFloater).css("top", "0px");
		$(jj_trigger).find("a").removeClass("link_focus");
	}, 200);
}

function hideFloatPanelImmedia()
{
	$("." + jj_curFloater).hide();
	$("." + jj_curFloater).css("left", "0px");
	$("." + jj_curFloater).css("top", "0px");
	$(jj_trigger).find("a").removeClass("link_focus");
}

var ALL = 0;
var PROJECT = 1;
var DEVICE = 2;
var TECH = 3;
var GROUP = 4;

var searchTypeArr = ["全部", "项目", "设备", "技术", "机构"];

var currentSearchType = ALL;
$(".search_menu li").bind("click", function(){
	var type = parseInt($(this).attr("type"));
	switch(type){
		case 0:
			currentSearchType = ALL;
		break;
		case 1:
			currentSearchType = PROJECT;
		break;
		case 2:
			currentSearchType = DEVICE;
		break;
		case 3:
			currentSearchType = TECH;
		break;
		case 4:
			currentSearchType = GROUP;
		break;
	}
	$(this).parent().hide();
	$("#searchCate").html(searchTypeArr[currentSearchType] + ' <span class="caret"></span>');
});

function getSearchType(){
	return currentSearchType;
}